package com.hellohoper.script.config.api.app;

import com.hellohoper.cloud.starter.redis.annotation.EnableRedis;
import com.hellohoper.cloud.starter.swagger.annotation.EnableSwaggerApi;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.sleuth.sampler.AlwaysSampler;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * 主程序
 * Created by hk on 17/8/19.
 */
@SpringBootApplication
@EnableEurekaClient
@EnableSwaggerApi
@EnableRedis
@EnableTransactionManagement
@MapperScan(basePackages = "com.hellohoper.script.config.api.app.dao")
public class ScriptConfigApi implements CommandLineRunner {

    private static final Logger LOGGER = LoggerFactory.getLogger(ScriptConfigApi.class);

    public static void main(String[] args) {
        SpringApplication.run(ScriptConfigApi.class, args);
    }

    @Override
    public void run(String... strings) throws Exception {
        LOGGER.info("程序启动。。。。。。。");
    }

    @Bean
    public AlwaysSampler defaultSampler(){
        // 分布式追踪，默认追踪全部
        return new AlwaysSampler();
    }
}